package main

import (
	"encoding/xml"
)

type Node struct {
	XMLName xml.Name `xml:"node"`
	ID      string   `xml:"id,attr"`
	UtmX    string   `xml:"utm_x,attr"`
	UtmY    string   `xml:"utm_y,attr"`
	UtmZ    string   `xml:"utm_z,attr"`
}

type Nd struct {
	XMLName xml.Name `xml:"nd"`
	Ref     string   `xml:"ref,attr"`
}

type ExtraPoints struct {
	XMLName xml.Name `xml:"extra_points"`
	ID      string   `xml:"id,attr"`
	Nds     []Nd     `xml:"nd"`
}

type Line struct {
	XMLName xml.Name `xml:"line"`
	Nds     []Nd     `xml:"nd"`
}

type Pavement struct {
	XMLName xml.Name `xml:"pavement"`
	ID      string   `xml:"id,attr"`
	Lines   []Line   `xml:"line"` //左右边界
}

type Center struct {
	XMLName xml.Name `xml:"center"`
	UtmX    string   `xml:"utm_x,attr"`
	UtmY    string   `xml:"utm_y,attr"`
	UtmZ    string   `xml:"utm_z,attr"`
}

type ExtraPointsRef struct {
	XMLName xml.Name `xml:"extra_points"`
	Ref     string   `xml:"ref,attr"`
}

type ExitPair struct {
	XMLName xml.Name `xml:"exit_pair"`
	From    string   `xml:"from,attr"`
	To      string   `xml:"to,attr"`
	Type    string   `xml:"type,attr"`
}

type PavementRef struct {
	XMLName xml.Name `xml:"pavement"`
	Ref     string   `xml:"ref,attr"`
}

type ConnectionType struct {
	XMLName xml.Name `xml:"connection_type"`
	Type    string   `xml:"type,attr"`
}

type Connection struct {
	XMLName        xml.Name       `xml:"connection"`
	ID             string         `xml:"id,attr"`
	Center         Center         `xml:"center"`
	ExtraPointsRef ExtraPointsRef `xml:"extra_points"`
	PavementRefs   []PavementRef  `xml:"pavement"`
	ExitPairs      []ExitPair     `xml:"exit_pair"`
	ConnectionType ConnectionType `xml:"connection_type"`
}

type IsReversible struct {
	XMLName xml.Name `xml:"is-reversible"`
	Value   string   `xml:"value,attr"`
}

type IsBidirectional struct {
	XMLName xml.Name `xml:"is-bidirectional"`
	Value   string   `xml:"value,attr"`
}

type IsRamp struct {
	XMLName xml.Name `xml:"is-ramp"`
	Value   string   `xml:"value,attr"`
}

type SectionType struct {
	XMLName xml.Name `xml:"section_type"`
	Type    string   `xml:"type,attr"`
}

type LaneType struct {
	XMLName xml.Name `xml:"type"`
	Val     string   `xml:"val,attr"`
}

type TurnType struct {
	XMLName xml.Name `xml:"turn_type"`
	Val     string   `xml:"val,attr"`
}

type LanemarkerRef struct {
	Ref string `xml:"ref,attr"`
}

type LaneSpeedLimits struct {
	XMLName xml.Name `xml:"lane_speed_limits"`
	Min     string   `xml:"min,attr"`
	Max     string   `xml:"max,attr"`
}

type Enter struct {
	XMLName xml.Name `xml:"enter"`
	Left    string   `xml:"left,attr"`
	Right   string   `xml:"right,attr"`
}

type Signal struct {
	XMLName xml.Name `xml:"signal"`
	Type    string   `xml:"type,attr"`
}

type TrafficLightType struct {
	XMLName xml.Name `xml:"type"`
	Value   string   `xml:"value,attr"`
}

type CountdownNumberWidth struct {
	XMLName xml.Name `xml:"countdown_number_width"`
	Value   string   `xml:"value,attr"`
}

type IsWaitingAreaLight struct {
	XMLName xml.Name `xml:"is_waiting_area_light"`
	Value   string   `xml:"value,attr"`
}

type IsInvalidSignal struct {
	XMLName xml.Name `xml:"is_invalid_signal"`
	Value   string   `xml:"value,attr"`
}

type TrafficLight struct {
	XMLName              xml.Name             `xml:"traffic_light"`
	ID                   string               `xml:"id,attr"`
	UtmX                 string               `xml:"utm_x,attr"`
	UtmY                 string               `xml:"utm_y,attr"`
	UtmZ                 string               `xml:"utm_z,attr"`
	Signals              []Signal             `xml:"signal"`
	Type                 TrafficLightType     `xml:"type"`
	CountdownNumberWidth CountdownNumberWidth `xml:"countdown_number_width"`
	IsWaitingAreaLight   IsWaitingAreaLight   `xml:"is_waiting_area_light"`
	IsInvalidSignal      IsInvalidSignal      `xml:"is_invalid_signal"`
}

type Lane struct {
	XMLName         xml.Name        `xml:"lane"`
	ID              string          `xml:"id,attr"`
	Type            LaneType        `xml:"type"`
	TurnType        TurnType        `xml:"turn_type"`
	LeftLanemarker  LanemarkerRef   `xml:"left_lanemarker"`
	RightLanemarker LanemarkerRef   `xml:"right_lanemarker"`
	LaneSpeedLimits LaneSpeedLimits `xml:"lane_speed_limits"`
	TrafficLight    TrafficLight    `xml:"traffic_light"`
}

type Section struct {
	XMLName         xml.Name        `xml:"section"`
	ID              string          `xml:"id,attr"`
	From            string          `xml:"from,attr"`
	To              string          `xml:"to,attr"`
	SectionType     SectionType     `xml:"section_type"`
	IsReversible    IsReversible    `xml:"is-reversible"`
	IsBidirectional IsBidirectional `xml:"is-bidirectional"`
	IsRamp          IsRamp          `xml:"is-ramp"`
	Lane            []Lane          `xml:"lane"`
	Enter           Enter           `xml:"enter"`
}

type Lanemarker struct {
	XMLName xml.Name `xml:"lanemarker"`
	ID      string   `xml:"id,attr"`
	Type    string   `xml:"type,attr"`
	Nds     []Nd     `xml:"nd"`
}

type RoadEdge struct {
	XMLName    xml.Name `xml:"road_edge"`
	ID         string   `xml:"id,attr"`
	AcrossType string   `xml:"across_type,attr"`
	Type       string   `xml:"type,attr"`
	Nds        []Nd     `xml:"nd"`
}

type SpeedHump struct {
	XMLName xml.Name `xml:"speed_hump"`
	ID      string   `xml:"id,attr"`
	Nds     []Nd     `xml:"nd"`
}

type ClearArea struct {
	XMLName xml.Name `xml:"clear_area"`
	ID      string   `xml:"id,attr"`
	Nds     []Nd     `xml:"nd"`
}

type ParkingSpace struct {
	XMLName xml.Name `xml:"parking_space"`
	ID      string   `xml:"id,attr"`
	Lines   []Line   `xml:"line"`
}

type Map struct {
	XMLName       xml.Name       `xml:"map"`
	ID            string         `xml:"id,attr"`
	ExtraPoints   []ExtraPoints  `xml:"extra_points"`
	Pavements     []Pavement     `xml:"pavement"`
	Connections   []Connection   `xml:"connection"`
	Sections      []Section      `xml:"section"`
	Lanemarkers   []Lanemarker   `xml:"lanemarker"`
	RoadEdges     []RoadEdge     `xml:"road_edge"`
	SpeedHumps    []SpeedHump    `xml:"speed_hump"`
	ClearAreas    []ClearArea    `xml:"clear_area"`
	ParkingSpaces []ParkingSpace `xml:"parking_space"`
	Nodes         []Node         `xml:"node"`
}
